package com.eightywork.life.application;

import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import cn.sharesdk.framework.ShareSDK;

import com.eightywork.life.R;
import com.eightywork.life.service.CacheService;
import com.eightywork.life.service.DataService;

import android.app.Application;
import android.app.Notification;

public class BaseApplication extends Application {
	public static final boolean DEBUG = true;
	
	
	@Override
	public void onCreate() {
		super.onCreate();
		ShareSDK.initSDK(getApplicationContext());
		JPushInterface.setDebugMode(false);
		JPushInterface.init(getApplicationContext());
		JPushInterface.setLatestNotifactionNumber(this, 3);			// 最多3个推送同时出现在通知栏
		setStyleBasic();
		CacheService.init(this);
		DataService.init();
	}
	
	
	
	/**
	 *设置通知提示方式 - 基础属性
	 */
	private void setStyleBasic(){
		BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(this);
		builder.statusBarDrawable = R.drawable.ic_launcher;		
		builder.notificationFlags = Notification.FLAG_AUTO_CANCEL;  //设置为点击后自动消失
		builder.notificationDefaults = Notification.DEFAULT_LIGHTS
				|Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE;  
		//设置为铃声（ Notification.DEFAULT_SOUND）或者震动（ Notification.DEFAULT_VIBRATE）  
		JPushInterface.setDefaultPushNotificationBuilder(builder);
	}
	
}
